from flask import Flask, jsonify
from flask_cors import CORS
import pandas as pd


app = Flask(__name__)
CORS(app)

@app.route('/api/test', methods=['GET'])
def test_api():
    data = pd.read_csv('./data/常州Temperature.csv')
    print(data)
    # 将Data数据变为列表
    date = data['Date'].tolist()
    # 将Maximum Temperature数据变为列表
    max_temp = data['Maximum Temperature'].tolist()
    return jsonify({
        'date': date,
        'max_temp': max_temp
    })

if __name__ == '__main__':
    app.run(debug=True,port=5000)